import service from '@/utils/request'

export function SUPPLIERApi() {
  const base = "/tbSupplier"
  const fn = {
    active(params){
      return service({
        url: base + '/statusById',
        method: 'post',
        params
      })
    },
    getPage(params) {
      return service({
          url: base + '/all',
          method: 'post',
          params
      })
    },
    del(id) {
      return service({
          url: '/CriteriaAPIStructure/deleteInstitutionCftcsById/'+id,
          method: 'delete',
      })
    },
    selectAllVariety(id) {
      return service({
          url: '/CriteriaAPIStructure/selectAllVariety',
          method: 'get',
      })
    },
    add(data) {
      return service({
          url: '/CriteriaAPIStructure/insertInstitutionCftcs',
          method: 'post',
          data
      })
    },
    edit(data) {
      return service({
          url: '/CriteriaAPIStructure/updateInstitutionCftcs',
          method: 'put',
          data
      })
    }
  }
  return fn;

}

export function TYPEApi() {
  const base = "/tbType"
  const fn = {
    activeSuppliersByTypeSupplierIds(params){
      return service({
        url: base + '/activeSuppliersByTypeSupplierIds',
        method: 'post',
        params
      })
    },
    TypeSupplierById(params){
      return service({
        url: '/tbTypeSupplier/oneById',
        method: 'post',
        params
      })
    },
    active(params){
      return service({
        url: base + '/statusById',
        method: 'post',
        params
      })
    },
    activeTypeSupplier(params){
      return service({
        url: base + '/statusByTypeSupplierId',
        method: 'post',
        params
      })
    },
    addSupplierByTypeId(params){
      return service({
        url: base + '/addSupplierByTypeId',
        method: 'post',
        params
      })
    },
    delSupplierByTypeSupplierId(params){
      return service({
        url: base + '/delSupplierByTypeSupplierId',
        method: 'post',
        params
      })
    },
    getPage(params) {
      return service({
          url: base + '/selectPageWithSupplier',
          method: 'post',
          data:JSON.stringify(params),
      })
    },
    activeSuppliersBySearch(params) {
      return service({
          url: base + '/activeSuppliersBySearch',
          method: 'post',
          data:JSON.stringify(params),
      })
    },
    typeSupplierEdit(params) {
      return service({
          url: '/tbTypeSupplier/edit',
          method: 'post',
          data:JSON.stringify(params),
      })
    },
    del(params) {
      return service({
        url: base + '/delById',
        method: 'post',
        params
      })
    },

    add(data) {
      return service({
        url: base + '/add',
        method: 'post',
        data:JSON.stringify(data),
      })
    },
    edit(data) {
      return service({
        url: base + '/editById',
        method: 'post',
        data:JSON.stringify(data),
      })
    }
  }
  return fn;

}
